<template>
  <div>
    <r-table
      :isPagination="true"
      :tableData="tableData"
      :tableCols="tableCols"
      :tablePage="tablePage"
      @refresh="init()"
    ></r-table>
  </div>
</template>
<script>
export default {
  data() {
    return {
      tableData: [],
      tableCols: [
        {
          label: "Device Number",
          prop: "id"
          // theme: e => e.status ? 'primary' : 'danger', type: "tag",
        },

        {
          label: "称编号",
          prop: "trayNo"
        },
        {
          label: "商品Name",
          prop: "goodsName"
        },
        {
          label: "补货Type",
          prop: "type",
          formatter: e => (e.type == 1 ? "上货" : e.type == 2 ? "下货" : "")
        },
        {
          label: "重量变化",
          prop: "weight",
          formatter: e =>
            e.type == 1 ? "+" + e.weight + e.unit : "-" + e.weight + e.unit
        }
      ],
      tablePage: { limit: 10, page: 1, total: 0 }
    };
  },
  components: {},
  computed: {},
  methods: {
    async init() {
      let param = { ...this.tablePage, id: this.$route.query.id };
      let res = await this.api.replenishRecord_details(param);
      if (res) {
        this.tableData = res.data.list;
        this.tablePage.total = res.data.total;
      }
    }
  },
  mounted() {
    this.init();
  }
};
</script>
<style scoped lang="scss"></style>
